package com.ruoyi.web.cp.domain.rm;

import cn.hutool.core.date.DateUtil;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author xiesm
 * @Description: TODO
 * @date 2025-07-21 17:06
 */
@Data
public class RmobMergeExcel {
    private String teamA;
    private String teamB;
    private String league;
    private String dateStr;
    private String halfScore;
    private String allScore;
    private List<Detail> details;

    public RmobMergeExcel(String teamA, String teamB, String league, Date date) {
        this.teamA = teamA;
        this.teamB = teamB;
        this.league = league;
        this.dateStr = DateUtil.format(date, "yyyy-MM-dd HH:mm");
    }

    public RmobMergeExcel(String teamA, String teamB, String dateStr) {
        this.teamA = teamA;
        this.teamB = teamB;
        this.dateStr = dateStr;
    }

    public RmobMergeExcel(String teamA, String teamB, String dateStr, String halfScore, String allScore) {
        this.teamA = teamA;
        this.teamB = teamB;
        this.dateStr = dateStr;
        this.halfScore = halfScore;
        this.allScore = allScore;
    }

    @Data
    public static class Detail {
        private String score;
        private String rm_plv;
        private String ob_plv;
        private String fit;
        private String redBlack;

        public Detail(RmobMergeExcel outer, String score, String rm_plv, String ob_plv,
                      String fit, boolean isHalf) {
            this.score = score;
            this.rm_plv = rm_plv;
            this.ob_plv = ob_plv;
            this.fit = fit;

            // 访问外部类 RmobMergeExcel 的属性
            String resultScore = isHalf ? outer.getHalfScore() : outer.getAllScore();
            this.redBlack = resultScore == null ? "" : (score.equals(resultScore) ? "黑" : "红");
        }
    }
}
